package com.codeoss.framework.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.codeoss.framework.request.AdvanceQueryPageRequest;
import com.codeoss.framework.response.AdvanceQueryPageResponse;
import com.codeoss.framework.service.IAdvanceQueryPageService;

@Controller
@RequestMapping("advancequerypage")
public class AdvanceQueryPageController {
	@Autowired
	private IAdvanceQueryPageService advanceQueryPageService;
	
	@RequestMapping(value = "init", method = RequestMethod.GET)
	@ResponseBody
	public AdvanceQueryPageResponse init(@RequestParam("pageCode") String pageCode){
		AdvanceQueryPageResponse advanceQueryPageResponse=advanceQueryPageService.init(pageCode);
		return advanceQueryPageResponse;
	}
	
	@RequestMapping(value = "dataSearch", method = RequestMethod.POST)
	@ResponseBody
	public AdvanceQueryPageResponse dataSearch(@RequestParam("pageCode") String pageCode,@RequestParam("listViewPageCode") String listViewPageCode,@RequestBody AdvanceQueryPageRequest request){
		AdvanceQueryPageResponse advanceQueryPageResponse=advanceQueryPageService.dataSearch(pageCode,listViewPageCode,request);
		return advanceQueryPageResponse;
	}
}
